package com.ydx.demo.service;

import com.ydx.demo.Dao.MedicineRepository;
import com.ydx.demo.entity.Medicine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicineService {
    @Autowired
    private MedicineRepository medicineRepository;

    public int addMedicine(Medicine medicine){
        return medicineRepository.addMedicine(medicine);
    }

    public int deleteMedicine(int id){
        return medicineRepository.deleteMedicine(id);
    }

    public int updateMedicine(Medicine medicine){
        return medicineRepository.updateMedicine(medicine);
    }

    public List<Medicine> findAllMedicines(){
        return medicineRepository.findAllMedicines();
    }

    public Medicine findMedicineById(int id){
        return medicineRepository.findMedicineById(id);
    }
}
    
